#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    int n;
    cin>>n;
    vector<int>v(n+1);
    unordered_map<int, int>m;
    for(int i=1;i<=n;i++)cin>>v[i],m[v[i]]++;
    for(int i=1;i<=n;i++)
    {
        vector<int>t;
        for(int j=1;j*j<=v[i];j++)
        {
            if(v[i]%j==0)
            {
                t.push_back(j);
                if(v[i]/j!=j)t.push_back(v[i]/j);
            }
        }
        int ans=0;
        for(auto x:t)ans+=m[x];
        cout<<ans-1<<endl;
    }

}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T=1;
    //cin>>T;
    while(T--)
    {
       solve();
    }
    return 0;
}